package model;

/**
 * 
 * @author Mathias
 */
public class OrderLine {

    private int id;
    private Product product;
    private Order order;
    private int amount;
    private double unitPrice;

    public OrderLine(int id, Product product, Order order, int amount, double unitPrice) {
        this.id = id;
        this.product = product;
        this.order = order;
        this.amount = amount;
        this.unitPrice = unitPrice;
    }
    
    public OrderLine() {
        id = 0;
        product = null;
        amount = 0;
        unitPrice = 0;
        order = null;
    }
    public Order getOrder()
    {
        return order;
    }

    public void setOrder(Order order)
    {
        this.order = order;
    }    

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
        order.notifyListeners();
    }

    public double getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(double unitPrice) {
        this.unitPrice = unitPrice;
        order.notifyListeners();
    }
}
